import 'package:flutter/material.dart';

void main() {
  // 1. 运行应用程序。
  runApp(const MaterialApp(
    home: Main(),
  ));
}

class Main extends StatelessWidget {
  const Main({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('商品订单案例'),
          backgroundColor: Colors.purple,
        ),
        body: Container(
          padding: const EdgeInsets.all(20),
          child: Column(
            children: [
              const Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text('2024-08-15 21:49:48'),
                  Text(
                    '代发货',
                    style: TextStyle(
                      color: Colors.red,
                    ),
                  ),
                ],
              ),
              const Divider(),
              Row(
                children: [
                  Image.network(
                    'https://yanxuan-item.nosdn.127.net/a09de222ed32efa8ffe359b1d5780574.jpg',
                    width: 100,
                    height: 100,
                  ),
                  const SizedBox(
                    width: 20,
                  ),
                  const Expanded(
                    flex: 8,
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      //  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('茶水分离杯耐热隔热玻璃杯茶水分离杯耐热隔热玻璃杯茶水分离杯耐热隔热玻璃杯茶水分离杯耐热隔热玻璃杯',
                            maxLines: 2,
                            overflow: TextOverflow.ellipsis,
                            style: TextStyle(
                              fontSize: 16,
                              fontWeight: FontWeight.bold,
                              color: Colors.black,
                              height: 1.5,
                            )),
                        SizedBox(height: 10),
                        Text(
                          '规格:白色240ml',
                          style: TextStyle(
                            color: Colors.grey,
                          ),
                        ),
                        SizedBox(height: 10),
                        Text('￥119.5'),
                      ],
                    ),
                  ),
                  Expanded(
                      child: Container(
                    height: 20,
                    width: 20,
                    alignment: Alignment.centerRight,
                    child: const Text('X2'),
                  )),
                ],
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.end,
                children: [
                  Column(
                    children: [
                      const Text('合计:￥238.0'),
                      const SizedBox(height: 10),
                      Container(
                        decoration: BoxDecoration(
                          border: Border.all(
                            color: Colors.black, // 设置边框颜色，这里以黑色为例，可根据需求修改
                            width: 1, // 设置边框宽度
                          ),
                        ),
                        child: ElevatedButton(
                          onPressed: () {
                            // 这里添加按钮点击后的处理逻辑
                            print("再次购买按钮被点击");
                          },
                          style: ButtonStyle(
                            shape:
                                WidgetStateProperty.all<RoundedRectangleBorder>(
                              const RoundedRectangleBorder(
                                borderRadius:
                                    BorderRadius.zero, // 将圆角半径设置为0，即取消圆角
                                side: BorderSide.none, //设置边框为透明
                              ),
                            ),
                            backgroundColor: WidgetStateProperty.all(
                                Colors.white), //设置按钮背景颜色
                            elevation: WidgetStateProperty.all(2), //设置阴影
                            padding: WidgetStateProperty.all(
                                const EdgeInsets.all(2)), //设置内边距
                          ),
                          child: const Text(
                            '再次购买',
                            style: TextStyle(
                              color: Colors.black,
                            ),
                          ),
                        ),
                      ),
                    ],
                  )
                ],
              )
            ],
          ),
        ));
  }
}
